package com.ailanyin.admin.runner;

import com.ailanyin.admin.modules.system.service.SysRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author ailanyin
 * @version 1.0
 * @since 2022/2/17 0017 上午 10:22
 */
@Component
@Order(value = 2)
@Slf4j
public class SysPermissionRunner implements ApplicationRunner {

    @Autowired
    private SysRoleService sysRoleService;

    /**
     * 项目启动时将所有权限字符串存入Redis中
     *
     * @param args args
     * @throws Exception Exception
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {

        sysRoleService.addAllPermToRedis();
        log.info("赋予admin所有权限成功");
    }
}
